#include <climits>
class Solution {
  public:
    int expandCenter(const string& s, int left, int right) {
        while (left >= 0 && right < s.size() && s[left] == s[right]) {
            left--;
            right++;
        }
        return right - left - 1;
    }
    int getLongestPalindrome(string A) {
       if(A.empty()) return 0;
       int start=0,end=0;
       for(int i=0;i<A.size();i++){
        int len1=expandCenter(A, i, i);
         int len2=expandCenter(A, i, i+1);
         int len=max(len1,len2);
         if(len>end-start){
            start=i-(len-1)/2;
            end=i+len/2;
         }
       }
       return end-start+1;
    }
};